Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Key Press Event Help

  1. #11
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Yes, you can. Immediately adding the extra up-velocity, adds it at once so the player will jump high very quickly. Both ways are equally valid, it depends on what you want.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  2. #12
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Example:
    Code:
    //self being rabbit player
    local.addheight = 56;           //amount the player will jump higher, in game units.
    local.add = local.addheight / 10;   //increment
    
    while (self && IsAlive self && self.rabbit == 1) {
             if (self.velocity[2] > 50.0) {
                 while (self.velocity[2] < (local.addHeight + 56.0)) {
                       self.velocity = ( self.velocity[0] self.velocity[1] (self.velocity[2] + local.add) )
                       waitframe //i.e. 0.05 seconds, so this adds all additional height velocity in half a second, change if necessary.
                 }
             }
         waitframe
    }
    Last edited by Sor; November 16th, 2012 at 02:29 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  3. #13

    Default

    Quote Originally Posted by Sor View Post
    Example:
    Code:
    //self being rabbit player
    local.addheight = 56;           //amount the player will jump higher, in game units.
    local.add = local.addheight / 10;   //increment
    
    while (self && IsAlive self && self.rabbit == 1) {
             if (self.velocity[2] > 50.0) {
                 while (self.velocity[2] < (local.addHeight + 56.0)) {
                       self.velocity = ( self.velocity[0] self.velocity[1] (self.velocity[2] + local.add) )
                       waitframe //i.e. 0.05 seconds, so this adds all additional height velocity in half a second, change if necessary.
                 }
             }
         waitframe
    }
    Thanks for the code sample Sor, but this didn't work for me. The rabbit just starts jumping uncontrollably. The rabbit is not even using his jump key. He just spawns and starts immediately jumping higher and bouncing until he's reached the top of the map and can go no further. Any idea why?
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  4. #14
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Try adding longer 'wait's in there , so you need one after he spawns ( because when you spawn you start higher and come back down to the ground ) which gives the script the impression the rabbit it jumping

    Also try adding a longer waitframe , so it gives the player time to get back to the ground before it checks to see if the player has jumped , since there is no wait , it keeps checking and makes the rabbit keep jumping higher

    Try changing them till they suit your needs

    I think

    Code:
    //self being rabbit player
    local.addheight = 56;           //amount the player will jump higher, in game units.
    local.add = local.addheight / 10;   //increment
    
    while (self && IsAlive self && self.rabbit == 1) 
    wait 2    // waits 2 seconds after spawn
    {
             if (self.velocity[2] > 50.0) {
                 while (self.velocity[2] < (local.addHeight + 56.0)) {
                       self.velocity = ( self.velocity[0] self.velocity[1] (self.velocity[2] + local.add) )
                        wait 2  // adjust this to give player enough time to land back on ground 
                       ///waitframe //i.e. 0.05 seconds, so this adds all additional height velocity in half a second, change if necessary.
                 }
             }
         
    }
    Now the above it just a guess as to where to put the waits , try and error :P

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  5. #15

    Default

    I've tried different variants of this, but none work.

    Code:
    while (level.rabbit != NULL && level.rabbit != NIL && isAlive(level.rabbit) && level.rabbit.dmteam != spectator)
        {        
                
                // Jump Settings
                if(level.rabbit.jumpTo == NIL || level.rabbit.jumpTo == NULL){
                  if(int(getcvar(rJumpMode))){
                    local.jumpMode = int(getcvar(rJumpMode))
                    // Is jump mode enabled
                    if(local.jumpMode == 1){
                      if(int(getcvar(rJumpHeight))){
                        level.jumpHeight = int(getcvar(rJumpHeight)) 
                      }else{
                        level.jumpHeight = 100
                      }
                      level.rabbit.jumpTo = level.jumpHeight
                      level.rabbit.velocity = ( level.rabbit.velocity[0] level.rabbit.velocity[1] (level.rabbit.velocity[2] + level.jumpHeight) )
                    }
                  }
                }
         }
         level.rabbit.jumpTo == NIL
    I keep getting this error to loop in my log though and the server eats up my cpu and memory:

    Code:
    CGM buffer for client 0 is full
    CGM buffer for client 1 is full
    CGM buffer for client 0 is full
    CGM buffer for client 1 is full
    Also, the rabbit only initially jumps that high when spawned. Each time the rabbit player jumps after, his jump height is still the same. I only want the rabbit to jump higher when the rabbit presses his jump key.

    If I keep it in the while loop as posted by Sor, the rabbit just continues to jump up like a ladder for some reason. He jumps up, gets half way to the ground, jumps up again, gets half way from the old point of jumping, and so on.

    I don't want to increase the wait time in that loop because it will mess up my seconds counter by adding more wait time than 1 second, so is it just a wait issue? How would I get it to not affect my time counter? Like this? But is this causing the CGM buffer overflows?

    Code:
    thread rabbitJump
    
    while (level.rabbit != NULL && level.rabbit != NIL && isAlive(level.rabbit) && level.rabbit.dmteam != spectator)
        {        
                
                // Jump Settings
                if(int(getcvar(rJumpMode))){
                  local.jumpMode = int(getcvar(rJumpMode))
                  // Is jump mode enabled
                  if(local.jumpMode == 1){
                    if(int(getcvar(rJumpHeight))){
                      level.jumpHeight = int(getcvar(rJumpHeight)) 
                    }else{
                      level.jumpHeight = 100
                    }
                  }
                }
         }
    
    rabbitJump:
       wait 5
       while(1){
         wait 2
         while (level.rabbit != NULL && level.rabbit != NIL && isAlive(level.rabbit) && level.rabbit.dmteam != spectator && level.jumpHeight != NIL && level.jumpHeight != NULL && level.rabbit.velocity[2] < (level.jumpHeight + 56.0)) {
            level.rabbit.velocity = ( level.rabbit.velocity[0] level.rabbit.velocity[1] (level.rabbit.velocity[2] + level.jumpHeight) )
            wait 2 //i.e. 0.05 seconds, so this adds all additional height velocity in half a second, change if necessary.
         }
       }
    end
    EDIT: HMM, I see you divide your jump variable by 10, so that you just increase it slightly until the rabbit reaches that height... you can't do what I'm doing because it happens all at once which causes the increasing height bunny hop?
    Last edited by own3mall; November 19th, 2012 at 09:06 PM.
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  6. #16

    Default

    Got it to work with this code:

    Code:
    rabbitJump:
       wait 5
       while(1){
         waitframe
         while (level.rabbit != NULL && level.rabbit != NIL && isAlive(level.rabbit) && level.rabbit.dmteam != spectator && level.jumpHeight != NIL && level.jumpHeight != NULL && level.rabbit.velocity[2] < (level.jumpHeight + 56.0) && level.rabbit.velocity[2] > 0) {
            level.rabbit.velocity = ( level.rabbit.velocity[0] level.rabbit.velocity[1] (level.rabbit.velocity[2] + (level.jumpHeight / 10)) )
            waitframe //i.e. 0.05 seconds, so this adds all additional height velocity in half a second, change if necessary.
         }
         waitframe
       }
    end
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  7. #17
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Thats good , i knew it had to do with adding a wait somewhere in there lol

    Im testing the new release in ffa mode tonight and ill get back to you on results , should be good tho :P

    Good Job

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  8. #18
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Sorry, didn't notice the new posts until now, but, yes, that'll work. I just wrote something, never tested if it worked. But I'd change your while() statement to this, though:
    Code:
    while (level.rabbit && isAlive(level.rabbit) && level.rabbit.dmteam != spectator && level.jumpHeight != NIL && level.rabbit.velocity[2] < (level.jumpHeight + 56.0) && level.rabbit.velocity[2] > 0)
    It removes the redundant checks.

    Either way, I'm glad it's working and I hope you learned something new about scripting.
    Last edited by Sor; November 20th, 2012 at 02:20 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •